package edu.hubu.store.dao;


import edu.hubu.store.domain.Order;
import edu.hubu.store.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.List;

/**
 * 订单
 *
 * @author admin
 */
@Repository
@Mapper
public interface OrderDao {
    /**
     * 生成订单
     *
     * @param order
     */
    public void addProduct(@Param("order") Order order);

    /**
     * 查找用户所属订单
     * @param user
     * @return
     */
    public List<Order> findOrderByUser(final User user);

    /**
     * 根据id查找订单信息
     *
     * @param id
     * @return
     */
    public Order findOrderById(String id);

    /**
     * 查找所有订单
     *
     * @return
     * @throws SQLException
     */
    public List<Order> findAllOrder();

    /**
     * 根据订单号修改订单状态
     *
     * @param id
     */
    public void updateOrderState(String id);
    /**
     * 多条件查询
     *
     * @param id
     * @param receiverName
     * @return
     */
    public List<Order> findOrderByManyCondition(@Param("id") String id,@Param("receiverName") String receiverName);

    /**
     * 根据id删除订单
     *
     * @param id
     * @throws SQLException
     */
    public void delOrderById(String id);
}
